package com.ruoyi.web.controller.ydz;

import java.util.List;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.web.domain.HospitalDisease;
import com.ruoyi.web.service.IHospitalDiseaseService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 医院疾病关联 Controller
 * 
 * @author why
 * @date 2025-05-13
 */
@Controller
@RequestMapping("/ydz/hospitalDisease")
@Api(tags = "医院疾病关联 ")
public class HospitalDiseaseController extends BaseController
{
    private String prefix = "ydz/hospitalDisease";

    @Autowired
    private IHospitalDiseaseService hospitalDiseaseService;

    @RequiresPermissions("ydz:hospitalDisease:view")
    @GetMapping()
    public String hospitalDisease()
    {
        return prefix + "/hospitalDisease";
    }

    /**
     * 查询医院疾病关联 列表
     */
    @RequiresPermissions("ydz:hospitalDisease:list")
    @PostMapping("/list")
    @ResponseBody
    @ApiOperation("查询医院疾病关联 列表")
    public TableDataInfo list(HospitalDisease hospitalDisease)
    {
        startPage();
        List<HospitalDisease> list = hospitalDiseaseService.selectHospitalDiseaseList(hospitalDisease);
        return getDataTable(list);
    }

    /**
     * 导出医院疾病关联 列表
     */
    @RequiresPermissions("ydz:hospitalDisease:export")
    @Log(title = "医院疾病关联 ", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    @ApiOperation("导出医院疾病关联 列表")
    public AjaxResult export(HospitalDisease hospitalDisease)
    {
        List<HospitalDisease> list = hospitalDiseaseService.selectHospitalDiseaseList(hospitalDisease);
        ExcelUtil<HospitalDisease> util = new ExcelUtil<HospitalDisease>(HospitalDisease.class);
        return util.exportExcel(list, "医院疾病关联 数据");
    }

    /**
     * 新增医院疾病关联
     */
    @GetMapping("/add")
    @ApiOperation("新增医院疾病关联 ")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存医院疾病关联
     */
    @ApiOperation("新增保存医院疾病关联 ")
    @RequiresPermissions("ydz:hospitalDisease:add")
    @Log(title = "医院疾病关联 ", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(HospitalDisease hospitalDisease)
    {
        return toAjax(hospitalDiseaseService.insertHospitalDisease(hospitalDisease));
    }

    /**
     * 修改医院疾病关联
     */
    @ApiOperation("修改医院疾病关联 ")
    @RequiresPermissions("ydz:hospitalDisease:edit")
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        HospitalDisease hospitalDisease = hospitalDiseaseService.selectHospitalDiseaseById(id);
        mmap.put("hospitalDisease", hospitalDisease);
        return prefix + "/edit";
    }

    /**
     * 修改保存医院疾病关联
     */
    @ApiOperation("修改保存医院疾病关联 ")
    @RequiresPermissions("ydz:hospitalDisease:edit")
    @Log(title = "医院疾病关联 ", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(HospitalDisease hospitalDisease)
    {
        return toAjax(hospitalDiseaseService.updateHospitalDisease(hospitalDisease));
    }

    /**
     * 删除医院疾病关联
     */
    @ApiOperation("删除医院疾病关联 ")
    @RequiresPermissions("ydz:hospitalDisease:remove")
    @Log(title = "医院疾病关联 ", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(hospitalDiseaseService.deleteHospitalDiseaseByIds(ids));
    }
}
